<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<jsp:include page="/web/inc/header"/>

<section>
    <div class="wrap">
        <div id="seach">
            <div id="logo"><a href="http://fenlicx.qinglab.cn" title="垃圾分类查询">分类查询</a></div>
            <div class="seach">
                    <input type="text" name="solrsearch" class="seach_txt" id="seach2" value="${param.solrsearch}">
                    <input type="button" class="seach_bun" name="button" id="button" value="查询分类">
            </div>
        </div>
      <article class="article">


          <span class="solrsearchData">

          </span>

    </article>
    </div>
</section>



<jsp:include page="/web/inc/footer"/>


<script src="<%=path%>/static/js/layui/layui.all.js"></script>
<script src="<%=path%>/static/js/jquery-3.3.1.min.js"></script>
<script>
    $(function () {
        //页面加载成功
        toSolrSearch(null);

        //点击搜索按钮，根据文章名搜索文章
        $(".seach_bun").click(function () {
            if($(".seach_txt").val().trim().length<1){
                layer.msg("查询内容不能为空",{icon:5});
                return;
            }
            toSolrSearch(null);
        })
    })


    function toSolrSearch(obj) {
        var pageNum = $(obj).attr("id");
        $.ajax({
            url:"<%=path%>/web/article/solrsearchData",
            data:{solrsearch:$(".seach_txt").val(),pageNum:pageNum},
            type:"GET",
            success:function (data) {
                 $(".solrsearchData").html(data);
                 $(".class"+pageNum).css("background-color","#87CFFA");
            }
        })
    }

</script>